declare namespace BaseApi {

  interface Page<T> {
    current: number
    size: number
    records: T[],
    pages: number,
    total: number,
  }

  interface Data<T> {

  }
}


/**
 * 权限
 */
declare namespace User {
  interface Login {
    username: string;
    name: string;
    userId: number;
    roles: string[];
    accessToken: string;
    accessTokenExpiresIn: number;
    refreshToken: string;
    refreshTokenExpiresIn: number;
  }

  interface UserDetails {
    userId?: number;
    username: string;
    //密码
    password?: string,
    email: string;
    name: string;
    createdAt?: string;
    updatedAt?: string;
    //在线离线
    status: 'ONLINE' | 'OFFLINE';
    accountLockedType: 'LOCK' | 'UNLOCK';
    //启用,1、开启，2、关闭
    enable: boolean;
    lastLogin: string;
    //男：MALE 女：FEMALE
    userGender: 'MALE' | 'FEMALE';
    phone: string;
    wechat?: string;
    avatar?: string;
    defaultRole?: number;
    roles: Role.BaseInfo[]
  }


  //用户基本信息
  interface BaseInfo {
    userId?: number | string;
    username: string;
    //密码
    password?: string,
    email: string;
    name: string;
    createdAt?: string;
    updatedAt?: string;
    //在线离线
    status: 'ONLINE' | 'OFFLINE';
    accountLockedType: 'LOCK' | 'UNLOCK';
    //启用,1、开启，2、关闭
    enable: boolean;
    lastLogin: string;
    //男：MALE 女：FEMALE
    userGender: 'MALE' | 'FEMALE';
    phone: string;
    wechat?: string;
    avatar?: string;
    defaultRole?: number;
  }
}

/**
 * 菜单namespace
 */
declare namespace Menu {
  // 定义路由配置接口
  export interface RouteConfig {
    path: string | '',
    component?: string;
    params?: Record<string, string>,
  }

//菜单类型 1.菜单，2.路由
  type MenuType = MENU_TYPE | ROUTE_TYPE | HREF_TYPE;
  type IconType = 1 | 2;

  //  1.菜单
  type MENU_TYPE = 1
  //2.路由
  type ROUTE_TYPE = 2
  //超链接
  type HREF_TYPE = 3

// 定义菜单项模型接口
  export interface MenuModel {
    //ID
    id?: number,
    //夫类ID
    parentId?: number,
    //菜单对应的标题
    title?: string;
    //菜单对应的name
    name?: string;
    //菜单图标
    icon?: string;
    order?: number;

    //是否需要权限才能够访问，0、不需要权限，1、需要权限
    requiresAuth?: boolean;
    //是否禁用
    disabled?: boolean;
    show?: boolean;
    //菜单类型
    menuType?: MenuType;
    //图标类型，1是，2是本地
    iconType?: IconType;
    href?: string;
    //对应路由
    route?: RouteConfig;
    //对应子类
    children?: MenuModel[];
    //其他属性，可以不要
    prop?: any;
  }

}


declare namespace Role {
  export interface BaseInfo {
    //ID
    roleId?: number,
    //角色名称
    roleName?: string,
    //角色说明
    description?: string;
    //创建时间
    createdAt?: string;
    //修改时间
    updatedAt?: string;
    //角色Code
    roleCode?: string;

    //状态 1.success ，2.warn
    status?: number;
    //对应的首页
    home?: Menu.MenuModel;
    //角色绑定的菜单
    menuIds?: []

  }
}
declare namespace Log {
  export interface BaseInfo {
    //ID
    operateId: number;
    //标题
    title: string;
    //业务类型，字典
    businessType: string;
    //方法名称
    method: string;
    //请求方式
    requestMethod: string;
    //操作人员的昵称
    operateName: string;
    //请求URL
    operateUrl: string;
    //主机地址
    operateIp: string;
    //请求参数
    operateParam: string;
    //返回参数
    jsonResult: string;
    //状态
    status: string;
    //错误消息
    errorMsg: string;
    //操作时间
    operateTime: string;
    //耗时
    costTime: string;
    //时间单位
    timeUnit: string;
  }
}



